package cm.wc.Dao.Imple;

import java.util.Random;

public class MyRunnable implements Runnable{
    ThreadLocal<Integer> threadLocal = new ThreadLocal<Integer>() {
        @Override
        protected Integer initialValue() {
            return 100;
        }
    };

    @Override
    public void run() {
        for (int i =0;i<4;i++){
            threadLocal.set(threadLocal.get()-10);
            System.out.println(Thread.currentThread().getName()+"-"+threadLocal.get());
            try {
                Thread.sleep(new Random().nextInt(300)+100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

}
